import requests
from config import url_cloud,headers_web,headers_file

class Laboratorys:
    def __int__(self):
        self.url = url_cloud
        self.headers = headers_web

    @classmethod
    def post_labmanagement(cls, url_cloud: str, headers=headers_web, params=None,json=None):
        '''
        Summary:实验室信息管理列表
        Description:云课堂实验室项目管理调用
        :param url:
        :param headers:
        :param params:
        :param json:
        :return:
        '''
        url = url_cloud + "/ICloudClassroomDev/v1/laboratorys/laboratorymanagement"
        r = requests.post(url=url, headers=headers, params=params,json=json)
        return r

    @classmethod
    def post_opennessStatistics(cls, url_cloud: str, headers=headers_web, params=None, json=None):
        '''
        Summary:接口-实验室开放情况统计
        Description:1、云课堂管理端实验室统计-预约开放情况统计使用
        :param url:
        :param headers:
        :param params:
        :param json:
        :return:
        '''
        url = url_cloud + "/ICloudClassroomDev/v1/laboratorys/openness/statistics"
        r = requests.post(url=url, headers=headers, params=params, json=json)
        return r

    @classmethod
    def post_dailyopencapacitystatistics(cls, url_cloud: str, headers=headers_web, params=None, json=None):
        '''
        Summary:接口-实验室每日开放容量统计
        Description:1、teachingApi学生每日预约率趋势接口使用
        :param url:
        :param headers:
        :param params:
        :param json:
        :return:
        '''
        url = url_cloud + "/ICloudClassroomDev/v1/laboratorys/openness/dailyopencapacitystatistics"
        r = requests.post(url=url, headers=headers, params=params, json=json)
        return r

    @classmethod
    def post_updatelaboratory(cls, url_cloud: str, headers=headers_web, params=None, json=None):
        '''
        Summary:修改实验室信息
        Description:云课堂web管理调用
        :param url:
        :param headers:
        :param params:
        :param json:
        :return:
        '''
        url = url_cloud + "/ICloudClassroomDev/v1/laboratorys/updatelaboratory"
        r = requests.post(url=url, headers=headers, params=params, json=json)
        return r

    @classmethod
    def post_importreservation(cls, url_cloud: str, headers=headers_file, params=None, data=None,files=None):
        '''
        Summary:实验位预约批量导入
        Description:云课堂web管理调用
        :param url_cloud:
        :param headers:
        :param params:
        :param data:
        :param file:
        :return:
        '''
        url = url_cloud + "/ICloudClassroomDev/api/v1/laboratorys/importreservation"
        r = requests.post(url=url, headers=headers, params=params,data=data,files=files)
        return r

    @classmethod
    def get_laboratorytree(cls, url_cloud: str, headers=headers_web, params=None):
        '''
        Summary:获取实验中心实验室树形结构
        Description:1.云课堂管理端-预约时间段配置使用
        :param url_cloud:
        :param headers:
        :param params:
        :return:
        '''
        url = url_cloud + "/ICloudClassroomDev/v1/teachingcenter/laboratory/tree"
        r = requests.get(url=url, headers=headers, params=params)
        return r

    @classmethod
    def get_laboratoryinfo(cls, url_cloud: str, headers=headers_web, params=None,paramspath=None):
        '''
        Summary:根据实验室Id获取实验室信息
        Description:
        :param url_cloud:
        :param headers:
        :param params:
        :param paramspath:
        :return:
        '''
        url = url_cloud + f"/ICloudClassroomDev/v1/laboratorys/{paramspath}"
        r = requests.get(url=url, headers=headers, params=params)
        return r

    @classmethod
    def get_laboratorytype(cls, url_cloud: str, headers=headers_web, params=None):
        '''
        Summary:获取实验室类型数据
        Description:云课堂web管理调用
        :param url_cloud:
        :param headers:
        :param params:
        :return:
        '''
        url = url_cloud + "/ICloudClassroomDev/v1/laboratorys/laboratorytype"
        r = requests.get(url=url, headers=headers, params=params)
        return r

    @classmethod
    def get_lab_by_tea_centerid(cls, url_cloud: str, headers=headers_web, params=None):
        '''
        Summary:根据实验中心id获取实验室信息列表
        Description:云课堂实验室项目管理调用
        :param url_cloud:
        :param headers:
        :param params:
        :return:
        '''
        url = url_cloud + "/ICloudClassroomDev/v1/laboratorys/laboratorysbyteachercenterid"
        r = requests.get(url=url, headers=headers, params=params)
        return r

    @classmethod
    def get_lab_by_tea_projectid(cls, url_cloud: str, headers=headers_web, params=None):
        '''
        Summary:根据项目Id获取实验室信息列表
        Description:云课堂实验室项目管理调用
        :param url_cloud:
        :param headers:
        :param params:
        :return:
        '''
        url = url_cloud + "/ICloudClassroomDev/v1/laboratorys/laboratorysbyprojectids"
        r = requests.get(url=url, headers=headers, params=params)
        return r

    @classmethod
    def get_startAndEndDate(cls, url_cloud: str, headers=headers_web, params=None):
        '''
        Summary:根据实验室开放时间Id和开放开始结束时间获取实验室开放时间列表
        Description:
        :param url_cloud:
        :param headers:
        :param params:
        :return:
        '''
        url = url_cloud + "/ICloudClassroomDev/v1/laboratorys/laboratoryOpenTimeDetailsByStartDateAndEndDate"
        r = requests.get(url=url, headers=headers, params=params)
        return r

    @classmethod
    def get_labOpenTimeDetails(cls, url_cloud: str, headers=headers_web, params=None):
        '''
        Summary:根据实验室开放时间Id获取实验室开放时间列表
        Description:
        :param url_cloud:
        :param headers:
        :param params:
        :return:
        '''
        url = url_cloud + "/ICloudClassroomDev/v1/laboratorys/laboratoryOpenTimeDetails"
        r = requests.get(url=url, headers=headers, params=params)
        return r

    @classmethod
    def get_getfloorsbyfuzzycondition(cls, url_cloud: str, headers=headers_web, params=None):
        '''
        Summary:根据楼层名称获取楼层列表
        Description:teaching项目调用
        :param url_cloud:
        :param headers:
        :param params:
        :return:
        '''
        url = url_cloud + "/ICloudClassroomDev/v1/laboratorys/getfloorsbyfuzzycondition"
        r = requests.get(url=url, headers=headers, params=params)
        return r

    @classmethod
    def get_laboratorys(cls, url_cloud: str, headers=headers_web, params=None):
        '''
        Summary:根据项目获取可预约实验室列表
        Description:
        :param url_cloud:
        :param headers:
        :param params:
        :return:
        '''
        url = url_cloud + "/ICloudClassroomDev/v1/laboratorys"
        r = requests.get(url=url, headers=headers, params=params)
        return r

    @classmethod
    def get_appointmentlabs(cls, url_cloud: str, headers=headers_web, params=None):
        '''
        Summary:获取实验室数据
        Description:云课堂web管理调用
        :param url_cloud:
        :param headers:
        :param params:
        :return:
        '''
        url = url_cloud + "/ICloudClassroomDev/api/v1/laboratorys/appointmentlaboratorys"
        r = requests.get(url=url, headers=headers, params=params)
        return r

if __name__ == '__main__':
    params3 = {
        "validCode": "155cc6439a2bd898c289a0a86ee1058c"
    }
    json3 = {"appointmentStatus": "",
             "labId": "",
             "page": 1,
             "pageSize": 10,
             "supportType": "",
             "teachingCenterId": "",
             "auditMethodValue": ""}
    resp3 = Laboratorys.post_labmanagement(url_cloud=url_cloud, params=params3, json=json3)
    print(resp3.content)